package dao;



import server.FruitsService;

import java.util.Objects;


public class Apple extends Fruits{

    public Apple() {
    }

    public Apple(String type, int count, Double money, Double discount) {
        super(type, count, money, discount);
    }

    public Double calculationApple(FruitsService fruitsService, Fruits fruits) {
        Double result = fruitsService.SingleFruits(fruits.getCount(), fruits.getMoney());
        if (!Objects.equals(fruits.getDiscount(), 1.0)){
            result =  fruitsService.DiscountFruits(result, fruits.getDiscount());
        }

        return result;
    }

}
